/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bankapp.view;

import framework.model.Constant;
import java.util.HashMap;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;

/**
 *
 * @author ThanhNguyen
 */
public class AddPersonalBankAccountDialog extends framework.view.AddPersonalAccountDialog {

    private JRadioButton JRadioButton_Chk;
    private JRadioButton JRadioButton_Sav;

    @Override
    public void initAccountTypeControls() {
        int y = 20;
        JRadioButton_Chk = new JRadioButton();
        JRadioButton_Chk.setText("Checkings");
        JRadioButton_Chk.setBounds(36 + y, 0, 100, 24);
        JRadioButton_Chk.setSelected(true);
        add(JRadioButton_Chk);
        JRadioButton_Sav = new JRadioButton();
        JRadioButton_Sav.setText("Savings");
        JRadioButton_Sav.setBounds(36 + y, 24, 100, 24);
        add(JRadioButton_Sav);
        ButtonGroup btnGroup = new ButtonGroup();
        btnGroup.add(JRadioButton_Chk);
        btnGroup.add(JRadioButton_Sav);
    }

    @Override
    public HashMap<String, String> getFields() {
        HashMap<String, String> fields = super.getFields();
        if (JRadioButton_Chk.isSelected()) {
            fields.put(Constant.BANK_ACCOUNT_TYPE, Constant.BANK_TYPE_CHECKING);
        }
        if (JRadioButton_Sav.isSelected()) {
            fields.put(Constant.BANK_ACCOUNT_TYPE, Constant.BANK_TYPE_SAVING);
        }
        return fields;
    }
}
